package com.tengju.motivation.domain.model.activity;

import lombok.AllArgsConstructor;


@AllArgsConstructor
public enum ActivityDesignateType {

    ALL(10, "全部"),
    JOIN(20, "指定参与"),
    NOT_JOIN(30, "指定不参与"),
    ;

    private final Integer val;
    private final String desc;

    public Integer getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    public static ActivityDesignateType fromVal(Integer val) {
        for (ActivityDesignateType type : values()) {
            if (type.val.equals(val)) {
                return type;
            }
        }
        return null;
    }

    public static ActivityDesignateType fromName(String name) {
        for (ActivityDesignateType type : values()) {
            if (type.name().equals(name)) {
                return type;
            }
        }
        return null;
    }

}
